package com.wxq.product.interceptor;

import lombok.Data;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Jim
 * @date 8:55 下午 2022/4/6
 * @description 拦截器
 * @email:huwmz04153277@126.com
 */
@Data
public class MyInterceptor implements HandlerInterceptor {
    private boolean state = false;
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        Object user = request.getSession().getAttribute("loginUser");
//        if (user == null){
//            //未登录,转发到登录页面
//            request.getRequestDispatcher("/index.html").forward(request,response);
//            return false;
//
//        }else{
//            //已登录
//            return true;
//        }
        return state;
    }

}
